<!-- 钱包 -->
<template>
  <div class="wallet">
    <div style="height: 200px;">
      <div class="myWallet">
        <img src="../../assets/myHead.png" alt="" width="50" height="50">
        <span>钱包1</span>
      </div>
      <img src="../../assets/navWallet.png" alt="" class="navWallet" width="20" height="20" @click="isShowModality=!isShowModality">
      <div class="totalProperty">
        <div style="color:#fff;font-size:22px;">
          <span style="color:#fff;font-size:13px;">≈</span>99.99
        </div>
        <div style="color:#f6f6f6;font-size:10px;">总资产(¥)</div>
      </div>
      <img src="../../assets/addWallet.png" alt="" width="25" height="25" class="addWallet" @click="$router.push({ path: '/main/addCurrency' })">
    </div>
    <div class="walletList">
      <ul>
        <li v-for="coins in coinsList" @click="trend(coins.name)">
          <div class="walletType">
            <img :src="coins.icon" alt="" width="25" height="25">
            <span style="font-size: 14px;margin-left: 5px;">{{coins.name}}</span>
          </div>
          <div class="walletMoney">
            <span class="money">{{coins.cmount}}</span>
            <span class="nearEqual">≈¥{{coins.price}}</span>
          </div>
        </li>
      </ul>
    </div>
    <div class="walletModality" :class="{showWalletModality:isShowModality}">
      <div class="walletModalityLeft" @click="isShowModality=false;"></div>
      <div class="walletModalityTxt">
        <div style="height:45px;background: #fff;"></div>
        <div class="myWalletAddress">我的钱包地址</div>
        <div style="margin-top:20px;padding-left:15px;">
          <!-- <div @click="$router.push({ path: '/main/addWallet' })">
            <img src="../../assets/addWalletAddress.png" alt="" height="20" width="20" style="vertical-align: middle;">
            <span style="vertical-align: middle;margin-left:10px;color:#666">添加钱包地址</span>
          </div> -->
          <div style="margin-top:10px;" @click="$router.push({ path: '/main/purseAddress' })">
            <img src="../../assets/addWalletAddress.png" alt="" height="20" width="20" style="vertical-align: middle;">
            <span style="vertical-align: middle;margin-left:10px;color:#666">钱包地址管理</span>
          </div>
        </div>
      </div>
    </div>
    <tabbar></tabbar>
  </div>
</template>
<script>
  import Tabbar from '../../components/common/Tabbar.vue'
  import http from '../../service/http.js'
  export default {
    components: {
      Tabbar,
    },
    data() {
      return {
        isShowModality: false,
        coinsList: []
      }
    },
    mounted() {
      this.getWalletList();
    },
    methods: {
      trend(name){
          this.$router.push({path:'/main/trend?name='+name})
      },
      getWalletList() {
        http.get("/coins/coins").then((res) => {
          if (res.status == 200) {
            this.coinsList = res.data.body;
          }
        })
      }
    }
  }
</script>
<style lang="less" scoped>
  .wallet {
    height: 200px;
    background-image: url('../../assets/myBgColor.png');
    position: relative;
  }

  .myWallet {
    text-align: center;
    padding-top: 20px;
    span {
      display: block;
      color: #f6f6f6;
    }
  }

  .navWallet {
    position: absolute;
    top: 15px;
    right: 10px;
  }

  .totalProperty {
    position: absolute;
    bottom: 20px;
    left: 10px;
  }

  .addWallet {
    position: absolute;
    right: 15px;
    bottom: 20px;
  }

  .walletList ul li {
    height: 60px;
    border-bottom: 1px solid #f6f6f6;
    padding: 0px 15px;
    position: relative;
    img {
      vertical-align: middle;
    }
  }

  .walletList .walletMoney {
    position: absolute;
    right: 15px;
    top: 0px;
    text-align: center;
    .money {
      color: #333;
      font-size: 22px;
      display: block;
      margin-top: 5px;
    }
    .nearEqual {
      font-size: 10px;
      position: absolute;
      right: 0px;
      top: 30px;
      color: #999;
      min-width: 100px;
      text-align: right;
    }
  }

  .walletList .walletType {
    position: absolute;
    left: 10px;
    top: 15px;
  }

  .walletModality {
    position: fixed;
    top: 0px;
    left: 100%;
    bottom: 53px;
    right: 0px;
    transition: all 0.1s;
    /* background: #000; */
    /* opacity: 0.4; */
    /* background: rgba(0, 0, 0, 0.4); */
    /* z-index: 666; */
  }

  .showWalletModality {
    position: fixed;
    top: 0px;
    left: 0%;
    bottom: 53px;
    right: 0px;
    transition: all 0.1s;
  }

  .walletModalityLeft {
    /* position: fixed;
    z-index: 999;
    top: 0px;
    left: 0px;
    bottom: 53px;
    right: 0px;
    background: rgba(0, 0, 0, 0.4); */
    background: rgba(0, 0, 0, 0.4);
    width: 40%;
    height: 100%;
    float: left;
  }

  .walletModalityTxt {
    /* position: fixed;
    z-index: 999;
    top: 0px;
    left: 40%;
    bottom: 53px;
    right: 0px;
    background: #fff; */
    margin-left: 40%;
    background: #fff;
    height: 100%;
  }

  .myWalletAddress {
    /* margin-top: 45px; */
    background: #f6f6f6;
    height: 40px;
    line-height: 40px;
    color: #666;
    padding-left: 10px;
  }
</style>